/**
 * 跳转到子项目详情页
 * @param url : 需要跳转的链接包括参数;
 * @param text: 链接显示的文字
 * @returns: 返回Link组件或a标签
 * @author: tongsitong
 */

import { Link } from "react-router-dom";

export const DetailLink = (url, text) =>
  // process.env.REACT_APP_ENV === "mock" ? (
  process.env.NODE_ENV !== "production" ? (
    <Link to={{ pathname: url }}> {text}</Link>
  ) : (
    <a
      onClick={() => {
        top.window.postMessage({ url: `/desert-star${url}` }, location.origin);
      }}
    >
      {text}
    </a>
  );
